import base from './base'
import axios from '@/utils/request'

const api = {
    totalInfo() {
        return axios.get(base.totalInfo)//首页统计数据
    },
    orderinfo() {
        return axios.get(base.orderinfo)//首页订单数据
    },
    format() {
        return axios.get(base.format)//首页折现图树状图数据
    },

    projectList(params) {
        return axios.get(base.projectList, { params })//产品列表
    },
    search(params) {
        return axios.get(base.search, { params })//产品查询
    },
    deleteItemById(params) {
        return axios.get(base.deleteItemById, { params })//删除产品
    },
    //商品类目，params:{type:cid}
    selectItemCategoryByParentId(params) {
        return axios.get(base.selectItemCategoryByParentId, { params })
    },
    //添加商品，params:{title cid  category sellPoint price num descs paramsInfo image}
    insertTbItem(params) {
        return axios.get(base.insertTbItem, { params })
    },
    //批量删除
    batchDelete(params) {
        return axios.get(base.batchDelete, { params })
    },
    //修改商品，params:{id title cid  category sellPoint price num descs paramsInfo image}
    updateTbItem(params) {
        return axios.get(base.updateTbItem, { params })
    },

    //产品分类
    itemCategory() {
        return axios.get(base.itemCategory)
    },

    //新增子级类目{cid name}
    insertItemCategory(params) {
        return axios.get(base.insertItemCategory, { params })
    },
    //修改类目 {id，name}
    updateCategory(params) {
        return axios.get(base.updateCategory, { params })
    },
    //删除类目{id}
    deleteContentCategoryById(params) {
        return axios.get(base.deleteContentCategoryById, { params })
    },
    //新增一级类目
    insertCategory(params) {
        return axios.get(base.insertCategory, { params })
    },

    //订单
    //订单列表
    orderList(params) {
        return axios.get(base.orderList, { params })
    },
    //订单汇总 ids=''
    changeStatus(params) {
        return axios.get(base.changeStatus, { params })
    },
    //汇总清单列表 {page}
    collect(params) {
        return axios.get(base.collect, { params })
    },
    //撤销汇总 {id}
    cancel(params) {
        return axios.get(base.cancel, { params })
    },
    //订单详情 {id}
    getDetail(params) {
        return axios.get(base.getDetail, { params })
    },

    //登录{user,pwd}
    login(params){
        return axios.post(base.login,params)
    },
    //用户权限--返回导航内容
    //params:{token:""}
    permission(params){
        return axios.get(base.permission,{params})
    }
};

//单个导出
export function  permission(params){
    return axios.get(base.permission,{params})
}

export default api